<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function Bank() {
        var n = window.prompt();
        var arr = n.split('');
        if (arr.length <= 4) {
          Fourin(arr);
        } else if (arr.length > 4 && arr.length <= 8) {
        } else if (arr.length > 8 && arr.length <= 10) {
        } else {
          alert('请输入合法数字');
          return;
        }
      }
      function Fourin(n) {
        var add = '';
        for (var i = n.length; i > 0; i--) {
          add += translate(n[i]);
        }
        return add;
      }
      function translate(n) {
        switch (n) {
          case 0:
            return '零';
          case 1:
            return '一';
          case 2:
            return '二';
          case 3:
            return '三';
          case 4:
            return '四';
          case 5:
            return '五';
          case 6:
            return '六';
          case 7:
            return '七';
          case 8:
            return '八';
          case 9:
            return '九';
        }
      }
      // Bank();
      console.log(Fourin(123));
    </script>
  </body>
</html>
